﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThouShaltNotBrick.Models;
using GMLogging;
using System.Windows;

namespace ThouShaltNotBrickLevelEditor.Code.GeneralObjects
{
    public sealed class BrickSelectorRect
    {
        #region Properties
        #region BrickTypeName
        /// <summary>
        /// BrickTypeName property.
        /// </summary>
        public string BrickTypeName { get; private set; }
        #endregion

        #region BrickStateName
        /// <summary>
        /// BrickStateName property.
        /// </summary>
        public string BrickStateName { get; private set; }
        #endregion

        #region BrickStateIndex
        /// <summary>
        /// BrickStateIndex property.
        /// </summary>
        public int BrickStateIndex { get; private set; }
        #endregion

        #region BrickStateRect
        /// <summary>
        /// BrickStateRect property.
        /// </summary>
        public Rect BrickStateRect { get; private set; }
        #endregion
        #endregion

        #region Constructors
        public BrickSelectorRect(
            BrickTypeData pBrickTypeData,
            int pBrickStateIndex,
            Rect pBrickStateRect)
        {
            if (pBrickTypeData == null)
            {
                Exception e = new ArgumentNullException("pBrickTypeData");
                Logger.Error(e.Message);
                throw e;
            }

            if (pBrickStateIndex < 0 || pBrickStateIndex >= pBrickTypeData.GetBrickStates().Count)
            {
                Exception e = new ArgumentException("Out of range.", "pBrickStateIndex");
                Logger.Error(e.Message);
                throw e;
            }

            BrickTypeName = pBrickTypeData.Name;
            BrickStateName = pBrickTypeData.GetBrickStates()[pBrickStateIndex];
            BrickStateIndex = pBrickStateIndex;
            BrickStateRect = pBrickStateRect;
        }
        #endregion
    }
}